package uiLayer;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.text.DecimalFormat;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableModel;
import javax.swing.text.JTextComponent;
import javax.swing.text.NumberFormatter;

import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JFormattedTextField;

import java.awt.GridLayout;
import java.awt.FlowLayout;

import javax.swing.BoxLayout;
import javax.swing.SwingConstants;

import ctrlLayer.CtrBPartner;
import ctrlLayer.CtrOrder;
import modelLayer.Customer;
import modelLayer.Product;
import modelLayer.SalesLine;
import modelLayer.SalesOrder;


public class UiOrderCreate extends JPanel {

	private JTextField txtOrderNo;
	private JTextField txtOrderDate;
	private JTextField txtSeller;
	private JTextField txtItemNo;
	private JSpinner txtQuantity;
	private JTextField txtPrice;
	private JCheckBox ckbMonthlyInvoice;
	private JCheckBox ckbDelivery;
	private JComboBox<String> comboBoxItemName;
	private JTextField txtCustomer;
	private JButton btnAddCustomer;
	private JButton btnAddItem;
	private JButton btnInvoice;
	private JButton btnCash;
	private JButton btnAnnuller;
	private DecimalFormat dFormat = new DecimalFormat("0.00");
	private JPanel orderNo;
	private JPanel customer;
	private JPanel addItem;
	private JLabel lblKunde;
	private JPanel checkBoxes;
	private JPanel totalPrice;
	private JPanel buttonPanel;
	private JTable slTable;
	private CtrOrder ctrSo;
	private final ArrayList<Product> pList;
	/**
	 * Create the panel.
	 */
	public UiOrderCreate() {
		ctrSo = new CtrOrder();
		pList = ctrSo.getAllProducts();
		setBorder(new EmptyBorder(10, 10, 10, 10));
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{0, 800, 0, 0};
		gridBagLayout.rowHeights = new int[]{20, 23, 170, 23, 23, 40, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.7, 1.0, 0.7, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);

		// Line 1: Order info
		orderNo = new JPanel();
		GridBagConstraints gbc_orderNo = new GridBagConstraints();
		gbc_orderNo.insets = new Insets(0, 0, 5, 5);
		gbc_orderNo.fill = GridBagConstraints.HORIZONTAL;
		gbc_orderNo.gridx = 1;
		gbc_orderNo.gridy = 0;
		add(orderNo, gbc_orderNo);
		orderNo.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 5));

		JLabel lblOrderNo = new JLabel("Ordrenr.:");
		lblOrderNo.setPreferredSize(new Dimension(60, 16));
		orderNo.add(lblOrderNo);

		txtOrderNo = new JTextField();
		orderNo.add(txtOrderNo);
		txtOrderNo.setEditable(false);
		txtOrderNo.setColumns(10);

		JLabel lblOrderDate = new JLabel("Ordredato:");
		lblOrderDate.setHorizontalAlignment(SwingConstants.TRAILING);
		lblOrderDate.setPreferredSize(new Dimension(100, 16));
		orderNo.add(lblOrderDate);

		txtOrderDate = new JTextField();
		orderNo.add(txtOrderDate);
		txtOrderDate.setEditable(false);
		txtOrderDate.setColumns(15);
		
		// Customer
		customer = new JPanel();
		FlowLayout flowLayout_1 = (FlowLayout) customer.getLayout();
		flowLayout_1.setAlignment(FlowLayout.LEADING);
		GridBagConstraints gbc_customer = new GridBagConstraints();
		gbc_customer.insets = new Insets(0, 0, 5, 5);
		gbc_customer.fill = GridBagConstraints.HORIZONTAL;
		gbc_customer.gridx = 1;
		gbc_customer.gridy = 1;
		add(customer, gbc_customer);

		lblKunde = new JLabel("Kunde:");
		lblKunde.setPreferredSize(new Dimension(60, 16));
		customer.add(lblKunde);

		txtCustomer = new JTextField();
		txtCustomer.setColumns(50);
		txtCustomer.setPreferredSize(new Dimension(100, 22));
		customer.add(txtCustomer);
		txtCustomer.setEditable(false);

		btnAddCustomer = new JButton("Tilf\u00F8j Kunde");
		customer.add(btnAddCustomer);
		btnAddCustomer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				addCustomer();
			}
		});
		txtCustomer.getDocument().addDocumentListener(new DocumentListener()
		{
			@Override
			public void changedUpdate(DocumentEvent e) {
				if(txtCustomer.getText().length() > 0){
					//ckbMonthlyInvoice.setEnabled(true);
				}
				else {
					ckbMonthlyInvoice.setEnabled(false);
				}
			}

			@Override
			public void insertUpdate(DocumentEvent e) {
				if(txtCustomer.getText().length() > 0){
					//ckbMonthlyInvoice.setEnabled(true);
				}
				else {
					ckbMonthlyInvoice.setEnabled(false);
				}
			}

			@Override
			public void removeUpdate(DocumentEvent e) {
				if(txtCustomer.getText().length() > 0){
					//ckbMonthlyInvoice.setEnabled(true);
				}
				else {
					ckbMonthlyInvoice.setEnabled(false);
				}
			}
		});

		// List of items
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
		GridBagConstraints gbc_scrollPane = new GridBagConstraints();
		gbc_scrollPane.fill = GridBagConstraints.BOTH;
		gbc_scrollPane.insets = new Insets(0, 0, 5, 5);
		gbc_scrollPane.gridx = 1;
		gbc_scrollPane.gridy = 2;
		add(scrollPane, gbc_scrollPane);
		
		UiTables uiTableGen = new UiTables();
		// Table with salesLines
		slTable = uiTableGen.salesLineTable(new ArrayList<SalesLine>());
		slTable.setPreferredScrollableViewportSize(new Dimension(550, 200));
		slTable.setToolTipText("Liste over tilføjede varer.");
		slTable.setRowHeight(22);
		slTable.setFillsViewportHeight(true);
		scrollPane.setViewportView(slTable);
		addItem = new JPanel();
		FlowLayout flowLayout = (FlowLayout) addItem.getLayout();
		flowLayout.setAlignment(FlowLayout.LEADING);
		GridBagConstraints gbc_addItem = new GridBagConstraints();
		gbc_addItem.insets = new Insets(0, 0, 5, 5);
		gbc_addItem.fill = GridBagConstraints.HORIZONTAL;
		gbc_addItem.gridx = 1;
		gbc_addItem.gridy = 3;
		add(addItem, gbc_addItem);
		txtItemNo = new JTextField();
		addItem.add(txtItemNo);
		txtItemNo.setText("Varenr.");
		txtItemNo.setForeground(Color.GRAY);
		txtItemNo.addFocusListener(new FocusAdapter() {
			@Override
			public void focusGained(FocusEvent arg0) {
				if(txtItemNo.getText().equals("Varenr.")){
					txtItemNo.setText("");
					txtItemNo.setForeground(Color.BLACK);
				}
			}
		});
		txtItemNo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				checkForIDMatch();
			}
		});
		txtItemNo.setToolTipText("Indtast varenr.");
		txtItemNo.setColumns(10);

		comboBoxItemName = new JComboBox<String>();
		comboBoxItemName.setPreferredSize(new Dimension(120, 22));
		addItem.add(comboBoxItemName);
		comboBoxItemName.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		//		comboBoxItemName.addMouseListener(new MouseAdapter() {
		//		@Override
		//		public void mouseClicked(MouseEvent e) {
		//			setDefaultMode();
		//		}
		//	});

		comboBoxItemName.setForeground(Color.BLACK);
		comboBoxItemName.setModel(new DefaultComboBoxModel(new String[] {"Varenavn"}));
		final JTextComponent tc =(JTextComponent) comboBoxItemName.getEditor().getEditorComponent();
		tc.setForeground(Color.BLACK);
		comboBoxItemName.setToolTipText("Indtast varenavn");
		comboBoxItemName.setEditable(true);
		txtQuantity = new JSpinner();
		txtQuantity.setPreferredSize(new Dimension(100, 22));
		addItem.add(txtQuantity);
		txtQuantity.setModel(new SpinnerNumberModel(new Integer(1), new Integer(1), null, new Integer(1)));

		txtQuantity.setToolTipText("Indtast antal");

		btnAddItem = new JButton("Tilf\u00F8j vare");
		btnAddItem.setPreferredSize(new Dimension(100, 25));
		addItem.add(btnAddItem);
		btnAddItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {	
				//Add item
				if(checkForIDMatch())
				{
					//Sæt totalprisen for ordren.
					addProductToOrder();
				}
			}
		});

		NumberFormat format = NumberFormat.getInstance();
		NumberFormatter formatter = new NumberFormatter(format);
		formatter.setValueClass(Integer.class);
		formatter.setMinimum(0);
		formatter.setMaximum(Integer.MAX_VALUE);
		// If you want the value to be committed on each keystroke instead of focus lost
		formatter.setCommitsOnValidEdit(true);

		// Packing and sending
		checkBoxes = new JPanel();
		GridBagConstraints gbc_checkBoxes = new GridBagConstraints();
		gbc_checkBoxes.insets = new Insets(0, 0, 5, 5);
		gbc_checkBoxes.fill = GridBagConstraints.HORIZONTAL;
		gbc_checkBoxes.gridx = 1;
		gbc_checkBoxes.gridy = 4;
		add(checkBoxes, gbc_checkBoxes);
		checkBoxes.setLayout(new BoxLayout(checkBoxes, BoxLayout.Y_AXIS));

		ckbMonthlyInvoice = new JCheckBox("Månedfaktura");
		checkBoxes.add(ckbMonthlyInvoice);
		ckbMonthlyInvoice.setEnabled(false);
		ckbMonthlyInvoice.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//Sæt statusen på baggrund af isPrivate. Er altid unreadable
				setReadability();
			}
		});

		// Total price
		totalPrice = new JPanel();
		FlowLayout flowLayout_2 = (FlowLayout) totalPrice.getLayout();
		flowLayout_2.setAlignment(FlowLayout.TRAILING);
		GridBagConstraints gbc_totalPrice = new GridBagConstraints();
		gbc_totalPrice.fill = GridBagConstraints.BOTH;
		gbc_totalPrice.gridx = 1;
		gbc_totalPrice.gridy = 5;
		add(totalPrice, gbc_totalPrice);

		JLabel lblNewLabel_3 = new JLabel("Total pris:");
		totalPrice.add(lblNewLabel_3);

		txtPrice = new JTextField();
		txtPrice.setHorizontalAlignment(SwingConstants.TRAILING);
		txtPrice.setPreferredSize(new Dimension(150, 30));
		totalPrice.add(txtPrice);
		txtPrice.setMinimumSize(new Dimension(100, 20));
		txtPrice.setEditable(false);
		txtPrice.setColumns(15);

		// Button Panel
		buttonPanel = new JPanel();
		buttonPanel.setBorder(new EmptyBorder(10, 10, 10, 0));
		FlowLayout flowLayout_3 = (FlowLayout) buttonPanel.getLayout();
		flowLayout_3.setAlignment(FlowLayout.TRAILING);
		GridBagConstraints gbc_buttonPanel = new GridBagConstraints();
		gbc_buttonPanel.insets = new Insets(0, 0, 0, 5);
		gbc_buttonPanel.fill = GridBagConstraints.HORIZONTAL;
		gbc_buttonPanel.gridx = 1;
		gbc_buttonPanel.gridy = 6;
		add(buttonPanel, gbc_buttonPanel);

		btnAnnuller = new JButton("Annuller");
		btnAnnuller.setPreferredSize(new Dimension(100, 25));
		buttonPanel.add(btnAnnuller);
		btnAnnuller.setAlignmentX(Component.CENTER_ALIGNMENT);
		btnAnnuller.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				cleanSlate();
			}
		});
		btnInvoice = new JButton("Faktura");
		btnInvoice.setPreferredSize(new Dimension(100, 25));
		buttonPanel.add(btnInvoice);
		btnInvoice.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				//Faktura salg
				invoiceSale();
				
			}
		});
		tc.getDocument().addDocumentListener(new DocumentListener()
		{
			@Override
			public void changedUpdate(DocumentEvent e) {
				setSearchItems();
			}

			@Override
			public void insertUpdate(DocumentEvent e) {
				setSearchItems();
			}

			@Override
			public void removeUpdate(DocumentEvent e) {
				setSearchItems();
			}


		}
				);
	}

	private void setReadability(){
		if(txtCustomer.getText()!= null){
			if(ctrSo.retrieveCustomerById(Integer.parseInt(txtCustomer.getText())).getIsPrivate() == true) {
				ckbMonthlyInvoice.setSelected(false);
			}
			else {
				ckbMonthlyInvoice.setSelected(true);
			}
		}
	}


	protected void cleanSlate(){
		ckbMonthlyInvoice.setSelected(false);
		txtCustomer.setText("");
		txtItemNo.setText("Varenr.");
		txtOrderNo.setText("");
		txtOrderDate.setText("");
		comboBoxItemName.getEditor().setItem("");
		slTable = new UiTables().salesLineTable(new ArrayList<SalesLine>());
		txtPrice.setText("");
	}

	protected void addCustomer() {	
		Customer cusObj = new Customer();
		ArrayList<Customer> customers = new CtrBPartner().retrieveAllCustomers();
		UiAddCustomerDialog dialog = new UiAddCustomerDialog((JFrame) this.getRootPane().getParent(), cusObj);
		dialog.setVisible(true);
		txtCustomer.setText("" + cusObj.getPartnerId());
		SalesOrder soObj = ctrSo.createOrder(cusObj.getPartnerId());
		txtOrderNo.setText(""+soObj.getOrderId());
		txtOrderDate.setText(soObj.getOrderDate());
		setReadability();
	}

	protected void setTotalPrice(){
		double val =ctrSo.getTotalOrderPrice(Integer.parseInt(txtOrderNo.getText()));
		System.out.println(val	);
		txtPrice.setText("" +  val);
	}

	protected void setSearchItems(){
		if(txtItemNo.getText().equals("Varenr")){
			txtItemNo.setText("");
			txtItemNo.setForeground(Color.BLACK);
			//txtPrice.setText("0.0");
		}
		Runnable doSearchItems = new Runnable() {
			@Override
			public void run(){
				DefaultComboBoxModel<String> model;
				if(comboBoxItemName.getEditor().getItem().toString().length() > 0)
				{
					String s = comboBoxItemName.getEditor().getItem().toString();
					ArrayList<String> match = new ArrayList<String>();
					match.add(s);
					for(Product product: pList){

						if(product.getName().toLowerCase().contains(comboBoxItemName.getEditor().getItem().toString().toLowerCase())){
							match.add(product.getName());
						}
					}
					model = new DefaultComboBoxModel<String>((String[]) match.toArray(new String[match.size()]));
				}
				else
				{
					model = new DefaultComboBoxModel<String>();
				}
				try {
					comboBoxItemName.setModel(model);

				}
				catch (Exception e) {
					System.out.println(e);
				}
				try {
					comboBoxItemName.showPopup();
				}
				catch (Exception e) {
					System.out.println(e);
				}

				checkForNameMatch(pList);
			}
		};
		SwingUtilities.invokeLater(doSearchItems);

	}

	protected void checkForNameMatch(ArrayList<Product> pList){
		String s = comboBoxItemName.getEditor().getItem().toString();
		boolean found = false;
		int i = 0;
		while(!found && i < pList.size()){
			if(pList.get(i).getName().toLowerCase().equals(s.toLowerCase()))
			{
				found = true;
				txtItemNo.setText("" + pList.get(i).getProductId());
				comboBoxItemName.hidePopup();
			}
			i++;
		}
	}

	protected boolean checkForIDMatch(){
		String s = txtItemNo.getText();
		try{
			int i = Integer.parseInt(s);
			try{	
				Product p = ctrSo.getProductById(i);
				comboBoxItemName.getEditor().setItem(p.getName());
				return true;
			}
			catch(Exception e){
				UiStandardDialog dialog = new UiStandardDialog("Produkt");
				dialog.objectNotFoundDialog();
			}
		}
		catch(Exception e){
			JOptionPane optionpane = new JOptionPane();
			optionpane.showMessageDialog(this, "Der kan kun søges på heltal, forsøg igen!");
		}
		return false;
	}

	protected void addProductToOrder(){
		if(!txtCustomer.getText().isEmpty()) {
		try{	
			int pID =Integer.parseInt(txtItemNo.getText());
			int quantity =Integer.parseInt(txtQuantity.getValue().toString());
			int oId =Integer.parseInt(txtOrderNo.getText());
			System.out.println("pid =" + pID + " oID =" + oId + " quantity ="+quantity);
			ctrSo.addProduct(Integer.parseInt(txtItemNo.getText()), Integer.parseInt(txtQuantity.getValue().toString()), Integer.parseInt(txtOrderNo.getText()));
			updateSLTable();
			setTotalPrice();
			txtItemNo.setText("Varenr");
			txtItemNo.setForeground(Color.GRAY);
			txtQuantity.setValue(1);
			comboBoxItemName.setModel(new DefaultComboBoxModel(new String[] {"Varenavn"}));
			comboBoxItemName.hidePopup();
		}
		catch(Exception i){
			UiStandardDialog dialog = new UiStandardDialog("Produkt");
			dialog.objectNotFoundDialog();
		}
		}
		else{
			UiStandardDialog dialog1 = new UiStandardDialog("Kunde");
			dialog1.objectNotFoundDialog();
		}
	}
	
	/**
	 * 
	 */
	private void invoiceSale(){
		ctrSo.invoicing(Integer.parseInt(txtOrderNo.getText()));
		cleanSlate();
	}
	
	/**
	 * Creates a new table with the new content.
	 */
	private void updateSLTable(){
		System.out.println("Antal saleslines= " +ctrSo.retrieveOrderFromDb(Integer.parseInt(txtOrderNo.getText())).getSalesLines().size());
		slTable = new UiTables().salesLineTable((ArrayList<SalesLine>) ctrSo.retrieveOrderFromDb(Integer.parseInt(txtOrderNo.getText())).getSalesLines());
		slTable.setVisible(true);
	}

	protected JTable getSlTable() {
		return slTable;
	}
/*
	protected void cashSale() {
		if(orderCtr.getOrder().getOrderLines().size() > 0){
			JOptionPane optionpane = new JOptionPane();
			try{
				String s = optionpane.showInputDialog("Total pris er: " + orderCtr.getOrder().getTotalPriceString() + " Betal!");
				s = s.replace(",", ".");
				double d = Double.parseDouble(s);
				try{
					optionpane.showMessageDialog(this, "Byttepenge: " + orderCtr.makePayment(d));
					orderCtr.endOrder();
					cleanSlate();
				}
				catch(Exception p){
					optionpane.showMessageDialog(this, "Det indtastede bel�b skal matche ordrens pris, eller v�re h�jere.");
				}

			}
			catch(Exception r){
				JOptionPane optionpane1 = new JOptionPane();
				optionpane1.showMessageDialog(this, "Input skal v�re tal!");
			}
		}
		else{
			JOptionPane optionpane2 = new JOptionPane();
			optionpane2.showMessageDialog(this, "Der er ikke tilf�jet nogen varer til ordren, og kan derfor ikke afsluttes.");
		}
	}
*/
/*
	protected void invoiceSale() {
		JOptionPane optionpane = new JOptionPane();
		if(orderCtr.getOrder().getCustomer() != null){
			if(orderCtr.getOrder().getOrderLines().size() > 0){
				orderCtr.endOrder();
				optionpane.showMessageDialog(this, "Faktura printes!");
				cleanSlate();
			}
			else{
				optionpane.showMessageDialog(this, "Der er ikke t�jet nogen varer til ordren, og kan derfor ikke afsluttes.");
			}
		}
		else{
			optionpane.showMessageDialog(this, "Der er ikke tilf�jet nogen kunde til ordren, og den kan derfor ikke faktureres.");
		}
	}

	protected void modifyOrderLine(){
		JOptionPane optionpane = new JOptionPane();
		Object[] options = {"Rediger", "Slet", "Annuller"};
		int n = optionpane.showOptionDialog(null,
				"Vil du redigere antallet,\neller slette linjen?",
				"V\u00E6lg",
				JOptionPane.YES_NO_CANCEL_OPTION,
				JOptionPane.QUESTION_MESSAGE,
				null,
				options,
				options[0]);
		switch(n){
		case JOptionPane.YES_OPTION:
			accessOrderLine();
			break;
		case JOptionPane.NO_OPTION:
			removeOrderLine();
			break;
		case JOptionPane.CANCEL_OPTION:
			break;
		default:
			break;
		}	
	}

	protected void accessOrderLine(){
		JOptionPane optionpane = new JOptionPane();
		int n = Integer.parseInt(optionpane.showInputDialog("Antallet af varen", slTable.getSelectedObject().getQuantity()));
		try{
			slTable.getSelectedObject().setQuantity(n);
			updateSLTable();
			txtPrice.setText("" + orderCtr.getOrder().getTotalPriceString());
		}
		catch(Exception e){
			optionpane.showMessageDialog(this, "Antallet skal v\u00E6re positive heltal.");
		}
	}

	protected void removeOrderLine() {
		StandardDialog dialog = new StandardDialog();
		int n = dialog.deleteDialog("ordrelinje");
		switch(n){
		case JOptionPane.YES_OPTION:
			orderCtr.getOrder().removeOrderLine(slTable.getSelectedObject());
			slTable.setModel(orderCtr.getOrder().getOrderLines());
			break;
		case JOptionPane.NO_OPTION:
			break;
		default:
			break;
		}
	}
*/
	protected void setDefaultMode(){
		JTextComponent tc = (JTextComponent) comboBoxItemName.getEditor().getEditorComponent();
		tc.setForeground(Color.BLACK);
		comboBoxItemName.setModel(new DefaultComboBoxModel(new String[] {""}));
	}



	/////////// Extra methods in order to customize OfferTab1, which extends OrderTab1.

	protected void setCheckBoxEnabled(){
		ckbDelivery.setEnabled(false);
		ckbMonthlyInvoice.setEnabled(false);
	}

	/**
	 * @return the txtOrderNo
	 */
	protected JTextField getTxtOrderNo() {
		return txtOrderNo;
	}

	/**
	 * @return the txtOrderDate
	 */
	protected JTextField getTxtOrderDate() {
		return txtOrderDate;
	}

	/**
	 * @return the txtSeller
	 */
	protected JTextField getTxtSeller() {
		return txtSeller;
	}

	/**
	 * @return the txtItemNo
	 */
	protected JTextField getTxtItemNo() {
		return txtItemNo;
	}

	/**
	 * @return the txtQuantity
	 */
	protected JSpinner getTxtQuantity() {
		return txtQuantity;
	}

	/**
	 * @return the txtPriceb
	 */
	protected JTextField getTxtPrice() {
		return txtPrice;
	}

	/**
	 * @return the ckbPacking
	 */
	protected JCheckBox getCkbPacking() {
		return ckbMonthlyInvoice;
	}

	/**
	 * @return the ckbDelivery
	 */
	protected JCheckBox getCkbDelivery() {
		return ckbDelivery;
	}

	/**
	 * @return the comboBoxItemName
	 */
	protected JComboBox<String> getComboBoxItemName() {
		return comboBoxItemName;
	}

	/**
	 * @return the txtCustomer
	 */
	protected JTextField getTxtCustomer() {
		return txtCustomer;
	}

	/**
	 * @return the btnAddCustomer
	 */
	protected JButton getBtnAddCustomer() {
		return btnAddCustomer;
	}

	/**
	 * @return the btnAddItem
	 */
	protected JButton getBtnAddItem() {
		return btnAddItem;
	}

	/**
	 * @return the btnInvoice
	 */
	protected JButton getBtnInvoice() {
		return btnInvoice;
	}

	/**
	 * @return the btnCash
	 */
	protected JButton getBtnCash() {
		return btnCash;
	}

	/**
	 * @return the btnAnnuller
	 */
	protected JButton getBtnAnnuller() {
		return btnAnnuller;
	}

	

}



